package com.hbnu.iostream;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * @author kittychen
 * @date 2025-09-30 17:23
 */
public class OutputStreamWriterDemo {

    public static void main(String[] args) {
        String path = "E:" + File.separator + "2309" + File.separator + "2309.txt";
        File file = new File(path);

        OutputStreamWriter writer = null;

        try {
            writer = new OutputStreamWriter(new FileOutputStream(file));

            writer.write("hello kitty");

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (writer != null) {
                    writer.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
